/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import request from '@/utils/request';
import { message } from 'antd';

// 获取订单申请/审核列表
export async function getRefundReviewList(params: any) {
  const { current: page, pageSize: size, ...rest } = params;
  delete params.current;
  delete params.pageSize;
  return request('/RefundReview/RefundReviewList', {
    method: 'POST',
    data: { page, size, ...rest },
  }).then((res) => {
    const { code, data, msg } = res;
    if (code == 0) {
      return {
        data: data.list,
        total: data.count,
      };
    } else {
      message.error(msg);
      return {
        data: [],
      };
    }
  });
}

// 添加审核信息
export async function refundReviewAdd(params: any) {
  return request('/RefundReview/RefundReviewAdd', {
    method: 'POST',
    data: params,
  });
}

// 删除审核信息
export async function refundReviewDel(params: any) {
  return request('/RefundReview/RefundReviewDel', {
    method: 'POST',
    data: params,
  });
}

// 审核
export async function refundReview(params: any) {
  return request('/RefundReview/review', {
    method: 'POST',
    data: params,
  });
}

// 获取资金流水信息
export async function getTradInfo(params: any) {
  return request('/RefundReview/getTradInfo', {
    method: 'POST',
    data: params,
  });
}

// 获取实时余额
export async function getBalance(params: any) {
  return request('/RefundReview/getMoney', {
    method: 'POST',
    data: params,
  });
}
